package com.buildupchao.shottingcard.runner;

import java.net.Socket;

/**
 * @author buildupchao
 *         Date: 2019/3/15 20:47
 * @since JDK 1.8
 */
public class ShottingCardSocket implements Runnable {

    private Socket socket;
    private volatile boolean stop = false;

    public ShottingCardSocket(Socket socket) {
        this.socket = socket;
    }

    public void run() {
        RideServerSocketAcceptor.setAliveTime(this, System.currentTimeMillis());
        while (true) {
            if (stop) {
                System.out.println(Thread.currentThread().getName() + " exit......");
                break;
            }
            // using socket
            System.out.println(Thread.currentThread().getName() + ".......");
        }
    }

    public void setStop(boolean stop) {
        this.stop = stop;
    }
}
